<template>
  <el-select v-model="value" placeholder="请选择" @change="changeValue($event)" clearable>
    <el-option
      v-for="item in dictData"
      :key="item.code"
      :label="item.name"
      :value="item.code"
    />
  </el-select>
</template>
<script>
export default {
  data() {
    return {
      value: '',
      dictData: [],
      callbackMethod: ''
    }
  },
  methods: {
    changeValue(e) {
      this.$emit(this.callbackMethod, this.value)
    },
    setSelectValue(value) {
      this.value = value
    },
    initDict(dictData, callbackMethod) {
      this.dictData = dictData
      this.callbackMethod = callbackMethod
    }
  }
}
</script>
